﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.CMS.ViewModels.ShopDetailsCmsViewModel>" %>

<%@ Import Namespace="ChoViet.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%=Html.Encode(Model.Shop.Name)%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/Shop/IndexCMS/", "back") %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Chi tiết gian hàng:<font color="red"><%=Model.Shop.ID%></font>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
      <script type="text/javascript">
          $(function() {
              $("#projectTabs").tabs();
          });
    </script>
    <div id="projectTabs">
        <ul>
            <li><a href="#projectTabs-1">Thông tin gian hàng</a></li>
            <li><a href="#projectTabs-2" id="googleTabs">Danh sách sản phẩm trong gian hàng(<%=Model.Ads.Count()%>)</a></li>
        </ul>
        <div id="projectTabs-1">
    <table class="admintable" width="100%">
        <tbody>
            <tr>
                <td class="key">
                    Chủ gian hàng:
                </td>
                <td>
                    <%= Html.Encode(Model.Shop.NameContact)%>
                </td>
                <td class="key">
                    Email
                </td>
                <td>
                    <%= Html.Encode(Model.Shop.EmailContact)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Di động
                </td>
                <td>
                    <%= Html.Encode(Model.Shop.MobileContact)%>
                </td>
                <td class="key">
                    Website
                </td>
                <td>
                    <%= Html.Encode(Model.Shop.WebsiteContact)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Công ty/Doanh nghiệp
                </td>
                <td colspan="3">
                    <%= Html.Encode(Model.Shop.CompanyContact)%>
                </td>
                <td class="key">
                    Yahoo
                </td>
                <td>
                    <%= Html.Encode(Model.Shop.YahooContact)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Địa chỉ
                </td>
                <td colspan="3">
                    <%=Html.Encode(Model.Shop.AddressContact)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Tỉnh thành
                </td>
                <td colspan="3">
                    <%=Html.Encode(Model.Shop.City.Name)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Danh mục
                </td>
                <td>
                    <%=Html.Encode(Model.Shop.Category.Name)%>
                </td>
                <td class="key">
                    Nhu cầu
                </td>
                <td>
                    <%=Html.Encode(Model.Shop.Demand.Name)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Ảnh đại diện
                </td>
                <td colspan="3">
                    <img src="<%=string.IsNullOrEmpty(Model.Shop.LogoPath) ? "" : Model.Shop.LogoPath%>" width="80px" height="70px" style="float:left"/>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Tên gian hàng
                </td>
                <td colspan="3">
                    <%= Html.Encode(Model.Shop.Name)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Thời gian hoạt động
                </td>
                <td colspan="3">
                   Ngày bắt đầu: <%=string.Format("{0:dd/MM/yyyy H:mm}", Model.Shop.OpenDate)%><br />
                   Ngày kết thúc: <%=string.Format("{0:dd/MM/yyyy H:mm}", Model.Shop.CloseDate)%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Giới thiệu gian hàng
                </td>
                <td colspan="3">
                    <%=Model.Shop.Description%>
                </td>
            </tr>
            
            <tr>
                <td class="key">
                    Metatitle
                </td>
                <td colspan="3">
                    <%=Model.Shop.MetaTile %>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Meta keyword
                </td>
                <td colspan="3">
                    <%=Model.Shop.MetaKeyword%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Meta description
                </td>
                <td colspan="3">
                    <%=Model.Shop.MetaDescription %>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Trạng thái Publish?
                </td>
                <td>
                    <%= Model.Shop.PubYN%> 
                </td>
                <td class="key">
                    Gian hàng tiêu biểu?
                </td>
                <td>
                    <%= Model.Shop.FocusYN%>
                </td>
            </tr>
        </tbody>
    </table>
    </div>
    <div id="projectTabs-2">
        <fieldset>
            <legend>Danh sách sản phẩm trong gian hàng(<%=Model.Ads.Count()%>)</legend>
            <%if (Model.Ads.Count() > 0)
              {%>
            <table width="100%" class="adminlist">
                        <%
                foreach (var item in Model.Ads)
                {
                    %>
                               <tr>
                               <td>
                                <%--<a href="/Ad/DetailsCms/<%=item.ID %>" title="<%=item.Title %>"><%=item.Title %></a>--%>
                                <div>
                                        <div class="aditem">
                                            <div class="imageAvatar">
                                                <a href="/Ad/DetailsCms/<%= item.ID %>"><img width="60" height="55" src="<%=ChoViet.Lib.Common.LinkUtils.UrlImageOrDefault(item.Image)%>" title="" alt="" /></a>
                                            </div>
                                            <div class="summary">
                                                    <a href="/Ad/DetailsCms/<%= item.ID %>"><%=Html.Encode(item.Title)%></a><br />
                                                    Giá: <%= item.Cost != null ? string.Format("{0:#,#}",item.Cost) + item.CostType.Name : "Liên hệ"%>
                                                    <%= Html.Encode(item.Area != null ? item.Area.Cities.Where(e => e.ID == item.CityID).Select(e => e.Name).FirstOrDefault() : "")%><br />
                                                    <span class="contactInfo">Người đăng:<span class="lightLale"><%=Html.Encode(item.NameContact)%></span>
                                                    Sđt:<span class="lightLale"><%=Html.Encode(item.MobileContact)%></span>
                                                      Email:<span class="lightLale"><%=Html.Encode(item.EmailContact)%></span>
                                                      <span class="lightLale" style="margin-left:5px"><%=string.IsNullOrEmpty(item.SourceUrl) ? "Tin chính chủ" : item.SourceUrl%></span>
                                                      </span>
                                            </div>
                                        </div>
                                    </div>
                                    </td> 
                                </tr>                                   
                        <%}%>
                          
             </table>
             <div>
                  <h3> <a href="/Shop/EditCms/<%=Model.Shop.ID%>">Cập nhật sản phẩm</a> </h3>
             </div>
             <% }
              else
              { %>
                  <h2>Bạn chưa có sản phẩm nào....</h2>
                  <h3>
                    <a href="/Shop/EditCms/<%=Model.Shop.ID%>">Cập nhật sản phẩm</a>
                  </h3>
                  <%} %>
        </fieldset>
    </div>
    </div>
    <%}
    %>
</asp:Content>
